home *** CD-ROM | disk | FTP | other *** search
- #include "DemoRoutines.h"
-
- void BlastRect( long value, Rect *rect, short x, short y, GWorldPtr dst )
- {
- PixMapHandle dstPixMap;
- short dstRowBytes;
- long dstBaseAddr;
- long dstAddr;
- char mmuMode;
- short row, column;
- short width;
- short height;
-
- dstPixMap = GetGWorldPixMap ( dst );
-
- dstBaseAddr = (long) GetPixBaseAddr ( dstPixMap ); /* get the address of the pixmap */
- dstRowBytes = (**dstPixMap).rowBytes & 0x7fff; /* get the row increment */
-
- if( (x + rect->right) < (**dstPixMap).bounds.right )
- width = rect->right - rect->left;
- else
- width = (**dstPixMap).bounds.right - (x + rect->left);
-
- if( (y + rect->bottom) < (**dstPixMap).bounds.bottom )
- height = rect->bottom - rect->top;
- else
- height = (**dstPixMap).bounds.bottom - (y + rect->top);
-
- x -= (**dstPixMap).bounds.left;
- y -= (**dstPixMap).bounds.top;
-
- dstBaseAddr = dstBaseAddr + (long)y*dstRowBytes + (x<<2);
- mmuMode = true32b;
- SwapMMUMode ( &mmuMode ); /* set the MMU to 32-bit mode */
- for ( row = 0; row < height; row++ )
- {
- dstAddr = dstBaseAddr;
- for ( column = 0; column < width; column++ )
- {
- *(long*)dstAddr = value;
- dstAddr += 4;
- }
- dstBaseAddr = (long) ( (char *) dstBaseAddr + dstRowBytes ); /* go to the next row */
- }
- SwapMMUMode ( &mmuMode ); /* restore the previous MMU mode */
- }
-
- void ImageBlastRect( Rect *rect, GWorldPtr dst )
- {
- short x,y;
- PixMapHandle dstPixMap;
- long value;
-
- dstPixMap = GetGWorldPixMap ( dst );
- for( y = (**dstPixMap).bounds.top; y < (**dstPixMap).bounds.bottom; y += rect->bottom )
- {
- for( x = (**dstPixMap).bounds.left; x < (**dstPixMap).bounds.right; x += rect->right )
- {
- value = GWGet32PixelAsm( dst, x, y );
- BlastRect( value, rect, x, y, dst );
- }
- }
- }
-